//
//  CounselViewController.h
//  community
//
//  Created by 小崔 on 2020/5/28.
//  Copyright © 2020 小崔. All rights reserved.
//

#import "CLNTabBarController.h"
#import "HomeViewController.h"
#import "CounselViewController.h"
#import "MineViewController.h"

@interface CLNTabBarController ()

@end

@implementation CLNTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self initTabBar];
}
- (void)initTabBar
{
    self.tabBar.barTintColor = RGBCOLOR(242, 242, 242);
    
    // 首页
    HomeViewController *homePageVC = [[HomeViewController alloc] init];
    UINavigationController *homePageNC = [[UINavigationController alloc] initWithRootViewController:homePageVC];
    [homePageNC.tabBarItem setImage:[[UIImage imageNamed:@"TabBar_HomePage"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    [homePageNC.tabBarItem setSelectedImage:[[UIImage imageNamed:@"TabBar_HomePage_Selected"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    [homePageNC.tabBarItem setTitleTextAttributes:@{NSFontAttributeName : SYSTEMFONT(11),NSForegroundColorAttributeName : [UIColor grayColor]} forState:UIControlStateNormal];
    [homePageNC.tabBarItem setTitleTextAttributes:@{NSFontAttributeName : SYSTEMFONT(11),NSForegroundColorAttributeName : [UIColor redColor]} forState:UIControlStateSelected];
    homePageVC.title = @"首页";
    //自选
    CounselViewController *optionVC = [[CounselViewController alloc] init];
    UINavigationController *optionNC = [[UINavigationController alloc] initWithRootViewController:optionVC];
    [optionNC.tabBarItem setImage:[[UIImage imageNamed:@"TabBar_Optional"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    [optionNC.tabBarItem setSelectedImage:[[UIImage imageNamed:@"TabBar_Optional_Selected"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    [optionNC.tabBarItem setTitleTextAttributes:@{NSFontAttributeName : SYSTEMFONT(11),NSForegroundColorAttributeName : [UIColor grayColor]} forState:UIControlStateNormal];
    [optionNC.tabBarItem setTitleTextAttributes:@{NSFontAttributeName : SYSTEMFONT(11),NSForegroundColorAttributeName :[UIColor redColor]} forState:UIControlStateSelected];
    optionVC.title = @"咨询";
    //我的
    MineViewController *mineVC = [[MineViewController alloc] init];
    UINavigationController *mineNC = [[UINavigationController alloc] initWithRootViewController:mineVC];
    [mineNC.tabBarItem setImage:[[UIImage imageNamed:@"TabBar_Mine"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    [mineNC.tabBarItem setSelectedImage:[[UIImage imageNamed:@"TabBar_Mine_Selected"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    [mineNC.tabBarItem setTitleTextAttributes:@{NSFontAttributeName : SYSTEMFONT(11),NSForegroundColorAttributeName : [UIColor grayColor]} forState:UIControlStateNormal];
    [mineNC.tabBarItem setTitleTextAttributes:@{NSFontAttributeName : SYSTEMFONT(11),NSForegroundColorAttributeName : [UIColor redColor]} forState:UIControlStateSelected];
    mineVC.title = @"个人中心";
    
    self.viewControllers = @[homePageNC,optionNC,mineNC];
    self.selectedIndex = 0;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
